import 'package:flutter/material.dart';
import 'package:fortune/page/child/me_page.dart';
import 'package:fortune/page/child/pet_page.dart';

import 'child/app_page.dart';
import 'child/home_page.dart';
import 'child/update_page.dart';

class Home extends StatefulWidget {
  @override
  HomePage createState() => HomePage();
}

class HomePage extends State<Home> with SingleTickerProviderStateMixin {
  int _currentIndex = 0;
  List pages = [];
  @override
  void initState() {
    super.initState();
    pages.add(home_page());
    pages.add(pet_page());
    // pages.add(app_page());
    pages.add(update_page());
    pages.add(me_page());
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: pages[_currentIndex],
      bottomNavigationBar: BottomNavigationBar(
        items: const [
          BottomNavigationBarItem(icon: Icon(Icons.home), label: "主页"),
          BottomNavigationBarItem(icon: Icon(Icons.rocket_launch), label: "神兽"),
          // BottomNavigationBarItem(icon: Icon(Icons.apps), label: "App"),
          BottomNavigationBarItem(icon: Icon(Icons.download), label: "更新"),
          BottomNavigationBarItem(
              icon: Icon(Icons.account_tree_rounded), label: "我的"),
        ],
        currentIndex: _currentIndex,
        onTap: (int i) {
          setState(() {
            _currentIndex = i;
          });
        },
        type: BottomNavigationBarType.fixed,
      ),
    );
  }
}
